package com.example.administrator.capital.mine;


import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.capital.R;
import com.example.administrator.capital.base.BaseBackFragment;
import com.example.administrator.capital.mine.second.AboutUsFragment;
import com.example.administrator.capital.mine.second.ArchivalInformationFragment;
import com.example.administrator.capital.mine.second.ContactUsFragment;
import com.example.administrator.capital.mine.second.InformationDisclosureFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * A simple {@link Fragment} subclass.
 * 平台信息
 */
public class PlatformInformationFragment extends BaseBackFragment {
    @BindView(R.id.about_us)
    TextView mAboutUs;
    @BindView(R.id.contact_us)
    TextView mContactUs;
    @BindView(R.id.archival_information)
    TextView mArchivalInformation;
    Unbinder unbinder;
    @BindView(R.id.information_disclosure)
    TextView mInformationDisclosure;
    private TextView mBack;
    public PlatformInformationFragment() {
        // Required empty public constructor
    }

    public static PlatformInformationFragment newInstance() {

        Bundle args = new Bundle();
        PlatformInformationFragment fragment = new PlatformInformationFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_platform_informatiom, container, false);
        unbinder = ButterKnife.bind(this, view);
        return attachToSwipeBack(view);
    }

    @Override
    protected void initView(View view) {
        super.initView(view);
        mBack = view.findViewById(R.id.app_title_back);
    }

    @Override
    protected void setListener() {
        super.setListener();
        mAboutUs.setOnClickListener(this);
        mInformationDisclosure.setOnClickListener(this);
        mContactUs.setOnClickListener(this);
        mArchivalInformation.setOnClickListener(this);
        mBack.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()) {
            case R.id.about_us:/*关于我们*/
                start(AboutUsFragment.newInstance());
                break;
            case R.id.information_disclosure:/*信息披露*/
                start(InformationDisclosureFragment.newInstance());
                break;
            case R.id.contact_us:/*联系我们*/
                start(ContactUsFragment.newInstance());
                break;
            case R.id.archival_information:/*备案信息*/
                start(ArchivalInformationFragment.newInstance());
                break;
            case R.id.app_title_back:
                _mActivity.onBackPressed();
                break;
        }
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
